<?php
/**
 * Created by PhpStorm.
 * User: gesangdianzi
 * Date: 2018/1/28
 * Time: 17:26
 */

namespace common\utils;


class Api
{

    /**
     * 淘宝手机信息接口
     */
    public static function mobileDetail_tb($mobile){
        $url = 'https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel='.$mobile;
        $curl = new Curl();
        $curl->setOpt(CURLOPT_SSL_VERIFYHOST,0);
        $curl->setOpt(CURLOPT_SSL_VERIFYPEER,0);
        $html = $curl->get($url);
        $arr = explode('=',$html->response);
        if(!isset($arr[1])){
            return false;
        }
        $str = mb_convert_encoding($arr[1], "UTF-8", "GBK");
        $detail = [];
        if(preg_match('/province:\'(.+?)\'/',$str,$out)){
            $detail['province'] = $out[1];
        }
        if(preg_match('/catName:\'(.+?)\'/',$str,$out)){
            $detail['catName'] = $out[1];
        }
        if(preg_match('/telString:\'(.+?)\'/',$str,$out)){
            $detail['telString'] = $out[1];
        }
        return $detail;
    }

    /**
     * 百度引擎查询手机信息
     */
    public static function mobileDetail_bd(){

    }
}